/*
 * Duplicate Detector Copyright (C) 2010 Marco Biscaro <marcobiscaro2112@gmail.com>
 * 
 * This file is part of Duplicate Detector.
 *
 * Duplicate Detector is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Duplicate Detector is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Duplicate Detector.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.googlecode.duplicatedetector.i18n;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;

/**
 * All available languages.
 * 
 * @author Marco Biscaro
 */
public final class Languages {

	public static final Map<String, Locale> LANGUAGES = new HashMap<String, Locale>();

	static {
		LANGUAGES.put("English", new Locale("en", "US"));
		LANGUAGES.put("Português", new Locale("pt", "BR"));
	}

	private Languages() {
		// can not instantiate
	}

	public static String getDefaultLanguage() {
		for (Entry<String, Locale> entry : LANGUAGES.entrySet()) {
			if (entry.getValue().equals(Locale.getDefault())) {
				return entry.getKey();
			}
		}
		return "English";
	}

	public static String getName(Locale locale) {
		for (Entry<String, Locale> entry : LANGUAGES.entrySet()) {
			if (entry.getValue().equals(locale)) {
				return entry.getKey();
			}
		}
		return "Unknown";
	}

}
